<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Thanhtoan extends CI_Controller {

    function __construct() {
        parent::__construct();
        $this->load->helper(array("url"));
        $this->load->model("HOADON");
        $this->load->model("CT_HOADON");
        $this->load->library('cart');
        $this->load->model('BaoKimPayment');
    }

    public function index() {
        $bk = new BaoKimPayment();
        $check = $bk->verifyResponseUrl($_GET);
        $trangthaigd = $_GET('transaction_status');
        $order_id=$_GET('order_id');
        if ($checck == true) {
            $hd = new Hoadon();
            $hd->set_baokim_transaction_status($trangthaigd);
            $today = date("Y-m-d H:i:s");
            date_default_timezone_set('Asia/Ho_Chi_Minh');
            $hd->set_ngaylap_hoadon($today);
            $hd->UpdateField("so_hoadon=".$order_id);
             redirect(base_url('index.php/welcome/lichsugd'));
        }
        else
        {
            
        echo 'Thông tin checksum không chính xác. Giao dịch không thành công';
        }
    }

}
